﻿using Astronergy.MES.App.Library;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Configuration.Install;
using System.Linq;
using System.Threading.Tasks;

namespace Astronergy.MES.App.Service
{
    [RunInstaller(true)]
    public partial class ProjectInstaller : System.Configuration.Install.Installer
    {
        public ProjectInstaller()
        {
            InitializeComponent();
            
            Configuration config = ConfigurationManager.OpenExeConfiguration(typeof(ProjectInstaller).Assembly.ManifestModule.Name);
            AppSettingsSection section = config.GetSection("appSettings") as AppSettingsSection;
            if (section != null)
            {
                string suffix = section.Settings["Location"].Value;
                if (!string.IsNullOrEmpty(suffix))
                {
                    this.serviceInstaller1.DisplayName = string.Format("{0}${1}", "Astronergy.MES.App.DataTransfer", suffix);
                    this.serviceInstaller1.ServiceName = string.Format("{0}${1}", "OEMDataTransfer", suffix);
                }
            }
        }
    }
}
